home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-05-07 | 1.4 KB | 42 lines | [TEXT/DWat] |
- % Asymptote demo #2
- % Plot a basic log-log graph of y=x^2 with log error bars
-
- graphunits in % Use inches to measure page coordinates
- graphframe 2 7 2 7 % Set the location of the graph on the page
- fontname Times % Change to the Times font for the graph
-
- % Calculate y = x*x for x = 1 to 25
- npts 25 % We will calculate 25 points
- rpn index >x % Put 1,2,3,4...25 into the x vector
- rpn <x <x * >y % Find the square of the x vector
- rpn 50 >e % Put a constant error of 50 into the e vector
-
- rpn <x log >x % Replace x and y with their logs
- rpn <y log >y
-
- graphlimits % Set the graph limits to show all of the points
- graphticks -1 0 -1 0 % Choose log tick marks
- drawframe % Draw the frame around the graph
- scale 1.5 % Make the scale factor bigger and draw the axis labels
- drawtitle Log Graph with Log Error Bars
- drawxlabel Log X
- drawylabel Log Y
-
- pointsymbol 4 filled % Choose filled squares for the point symbols
- scale 1.5 % Draw big points
- plotpoints
- scale 1 % Set the scale factor back
- pensize 1 % Set up to draw 1 point thick line
- plotline % Plot the line
- pensize .25 % Set up for hairlines
-
- rpn <e >r0 % Save the errors in register 0
-
- rpn <y 10^x <e + log <y - >e % Calculate the -y error and draw the error bar
- ploterrors bottom % Plot the errors
-
- rpn <r0 >e % Recall the errors and do the same for the + y error
- rpn <y 10^x <e + log <y - >e
- ploterrors top % Plot the + y error bars
-
- fullscreen yes